<?php


namespace app\partneradmin\controller;


use app\common\controller\partneradmin\Base;

class Sysconfig extends Base
{
    protected $noNeedLogin = [];

    protected $model;


    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\partneradmin\model\SysConfig;
    }

    public function index()
    {
        //设置过滤方法
        if ($this->request->isPost()) {
            $sort = 'id';
            $order = 'desc';
            $list = $this->model
                ->field('*')
                ->order($sort, $order)
                ->select();
            $data = [
                'list' => $list,
            ];
            $this->success('列表', '', $data);
        }
    }

    /**
     * 禁止新增
     */
    public function add()
    {
        $this->error('添加失败！该模块不允许添加');
    }

    public function edit($ids = null)
    {
        $this->error('修改失败！该模块合作方不允许编辑');
    }

    /**
     * 获取详情
     * @param string $ids
     */
    public function details($ids = "")
    {
        $row = $this->model->get($ids);
        if (!$row) {
            $this->error('未查询到数据！', '', [], 404);
        }

        $data = json_decode($row['according'], true);
        $this->success('详情数据', '', $data);
    }

    /**
     * 禁止删除
     */
    public function del($ids = "")
    {
//        parent::del($ids); // TODO: Change the autogenerated stub
        $this->error('删除失败！该模块不允许删除');
    }
}